<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="renderer" content="webkit">
    <meta http-equiv="Cache-Control" content="no-siteapp"/>
    <title>houselai-admin</title>
    <meta name="keywords" content="">
    <meta name="description" content="">
    <link rel="shortcut icon" href="/favicon.ico"/>
    <!--[if lt IE 9]>
    <meta http-equiv="refresh" content="0;ie.html"/>
    <![endif]-->

    <link rel="stylesheet" type="text/css" href="/static/css/admin/bootstrap.min14ed.css"/>
    <link rel="stylesheet" type="text/css" href="/static/css/admin/font-awesome.min93e3.css"/>
    <link rel="stylesheet" type="text/css" href="/static/css/admin/plugins/dataTables/dataTables.bootstrap.css"/>
    <link rel="stylesheet" type="text/css" href="/static/css/admin/animate.min.css"/>
    <link rel="stylesheet" type="text/css" href="/static/css/admin/style.min862f.css"/>
    <link href="/static/css/admin/admincommon.css?v=20180820" rel='stylesheet' type='text/css'/>

    <style type="text/css">

        .select-box {
            border: solid 1px #ddd;
            box-sizing: border-box;
            vertical-align: middle;
            width: 20%;
            display: inline-block
        }

        .select {
            border: solid 1px #ddd;
            box-sizing: border-box;
            cursor: pointer;
            line-height: normal;
            font-weight: normal;
            width: 100%;
            white-space: nowrap
        }

        .select-box .select {
            border: none
        }

        .select-box.inline, .select-box.inline .select {
            width: auto
        }

        .select-box, .select-box.size-M {
            padding: 4px 5px
        }

        .select, .size-M .select {
            font-size: 14px
        }

        .select-box.size-MINI {
            padding: 0px 5px
        }

        .size-MINI .select {
            font-size: 12px
        }

        .select-box.size-S {
            padding: 3px 5px
        }

        .size-S .select {
            font-size: 12px
        }

        .select-box.size-L {
            padding: 8px 5px
        }

        .size-L .select {
            font-size: 16px
        }

        .select-box.size-XL {
            padding: 10px 5px
        }

        .size-XL .select {
            font-size: 18px
        }

        @media (max-width: 767px) {
            .responsive .select-box {
                border: none
            }

            .responsive .select-box .select,
            .responsive .select {
                border: solid 1px #ddd;
                padding: 10px;
                font-size: 16px
            }

            .responsive .select-box,
            .responsive .select-box.size-M,
            .responsive .select-box.size-MINI,
            .responsive .select-box.size-S,
            .responsive .select-box.size-L,
            .responsive .select-box.size-XL {
                height: auto;
                padding: 0
            }
        }
    </style>
</head>

<body class="gray-bg">
<div class="wrapper wrapper-content animated fadeInRight">
    <div class="row">
        <div class="col-sm-12">
            <div class="ibox float-e-margins">
                <div class="ibox-title">
                    <h5>交易明细</h5>
                    <div class="ibox-tools">
                        <a href="javascript:location.replace(location.href);" class="btn btn-primary btn-circle"
                           type="button" style="margin-bottom:0px;margin-right:10px;position:relative;top:-5px;"
                           title="刷新">
                            <i class="fa fa-refresh"></i>
                        </a>
                    </div>
                </div>
                <div class="ibox-content">
                    <form action="" method="post" id="export">
                        <div class="form-group col-sm-3" style="padding-left:0px;">
                            <input type="text" id="keywords" name="keywords" value="{$keywords}"
                                   placeholder="输入交易号/地址" class="form-control" onkeyup="searchTitle(this);"/>
                        </div>
                        <div class="form-group col-sm-2" style="padding-left:0px;">
                            <input class="form-control" type="text" name="range" id="range"
                                   value="{$range}" placeholder="请选择时间" autocomplete="off">
                        </div>
                        <div class="form-group col-sm-2" style="padding-left:0px;">
                            <select class="form-control" size="1" name="dinosaur_type">
                                <option value="-1">请选择恐龙级别</option>
                                <volist name="dinosaur" id="v" key="k">
                                    <option
                                    <?php if(isset($dinosaur_type) && $dinosaur_type == ($k-1)) echo "selected"; ?>
                                    value="{$k-1}">{$v}({$k-1})</option>
                                </volist>
                            </select>
                        </div>
                        <button type="submit" class="btn btn-xm btn-primary" onclick="check(1)">搜索</button>

                        <button type="button" class="btn btn-xm btn-primary" onclick="check(2)">导入到EXCEL</button>
                    </form>
                    <table id="mytable" class="table table-striped table-bordered table-hover dataTables-example">
                        <thead>
                        <tr>
                            <th>交易号</th>
                            <th>返回时间</th>
                            <th>买家地址</th>
                            <th>卖家地址</th>
                            <th>交易恐龙名称(级别)</th>
                            <th>恐龙NFT ID</th>
                            <th>成交价(INGold)</th>
                            <th>交易txid</th>
                        </tr>
                        </thead>
                        <tbody>
                        <volist name="data" id="vo">
                            <tr class="gradeX" id="article-{$vo['id']}">
                                <td>{$vo['transaction_no']}</td>
                                <td>{$vo['return_time']}</td>
                                <td>{$vo['buyers_address']}</td>
                                <td>{$vo['seller_address']}</td>
                                <td>{$vo['dinosaur_name']}({$vo['dinosaur_level_id']})</td>
                                <td>{$vo['nft_id']}</td>
                                <td>{$vo['trans_price']}</td>
                                <td>{$vo['trans_txid']}</td>
                            </tr>
                        </volist>
                        </tbody>
                    </table>
                    {$page|raw}
                </div>
            </div>
        </div>
    </div>
</div>
<js href="/static/js/admin/jquery.min.js"/>
<js href="/static/js/admin/bootstrap.min.js"/>
<js href="/static/js/admin/content.min.js"/>
<js href="/static/js/admin/plugins/layui/layer/layer.js"/>
<script type="text/javascript" src="/static/js/admin/admincommon.js?v=20180820"></script>

<script>
    laydate.render({
        elem: '#range', //指定元素
        range: true
    });

    function check(id) {
        var url = "{:url('admin/transaction/getlist')}";
        var excel_url = "{:url('admin/transaction/export')}";
        console.log(id);
        if (id == 1) {
            console.log(url);
            $( "#export" ).attr( 'action' ,url);     //通过jquery为action属性赋值
        } else {
            console.log(excel_url);
            $( "#export" ).attr( 'action' ,excel_url).submit();     //通过jquery为action属性赋值
        }
    }

    function searchTitle(obj) {
        var keywords = $.trim($(obj).val());

        if (keywords.length <= 0) {
            window.location.replace(location.href);
        }
    }

</script>

</body>
</html>